@extends('admin.layout')
@section('title',$title)
@section('content')
<div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                文章列表
                <small>文章列表</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
                <li><a href="#">文章列表</a></li>
                <li class="active">文章列表</li>
            </ol>
        </section>
        @if(session('info'))
        <div class="alert alert-danger alert-dismissable">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&time;</button>
                            <h4><i class="icon fa fa-ban"></i>提示！</h4>
                            <p>{{session('info')}}</p>
                            </div>
        @endif
        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    

                    <div class="box">
                        <div class="box-header">
                            <h3 class="box-title">文章列表</h3>
                        </div><!-- /.box-header -->

                        <div class="box-body">
                            <form action="{{url('/admin/user/index')}}">
                                <div class="col-xs-3">
                                
                                    <select name = "num" class="form-control">
                                            <option 
                                                @if(!empty($request['num'])&&$request['num']==5)
                                                selected
                                                @endif 
                                            >5</option>
                                            <option 
                                                @if(!empty($request['num'])&&$request['num']==10)
                                                selected
                                                @endif 
                                                >10</option>
                                            <option
                                                @if(!empty($request['num'])&&$request['num']==20)
                                                selected
                                                @endif 
                                            >20</option>
                                            
                                    </select>
                                
                                </div>
                                <div class="col-xs-4 ">
                                </div>
                                <div class="col-xs-5 ">
                                    <div class="input-group input-group">
                                        <input name="keywords" type="text" value="{{$request['keywords'] or ''}}" class="form-control">
                                        <span class="input-group-btn">
                                            <button class="btn btn-info btn-flat" >搜索</button>
                                        </span>
                                    </div><!-- /input-group -->
                                </div>
                                </form>
                                <table id="example1" class="table table-bordered table-striped">
                                <thead>
                                
                                <tr>
                                    <th>ID</th>
                                    <th>文章标题</th>
                                    
                                    <th>文章图片</th>
                                    <th>作者</th>
                                    <th>创建时间</th>
                                    <th>更新时间</th>
                                    <th>操作</th>
                                </tr>
                               
                                </thead>
                                <tbody>
                               @foreach($data as $v)
                               <tr>
                                    <td>{{$v -> id}}</td>
                                    <td>{{$v -> title}}</td>
                                    <td><img src="{{$v ->img}}" width="50"></td>
                                    
                                    <td>{{$v -> author}}</td>
                                    <td>{{$v -> create_at}}</td>
                                    <td>{{$v -> update_at}}</td>
                                    
                                    <td><a class="btn btn-block btn-success btn-xs" href="/admin/article/{{$v ->id}}/edit">编辑</a>  
                                    <form action = "/admin/article/{{$v ->id}}" method="post">
                                    {{csrf_field()}}
                                    {{method_field('DELETE')}}
                                    <button class="btn btn-block btn-success btn-xs">删除</button></td>
                                </tr>
                                 @endforeach
                                </tbody>
                                
                            </table>
                            {{$data->appends($request)->render()}}
                        </div><!-- /.box-body -->
                    </div><!-- /.box -->
                </div><!-- /.col -->
            </div><!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
    @endsection